package com.xuecheng.content.api;


import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "教师信息新增编辑接口",tags = "教师信息新增编辑接口")
@RestController
@RequestMapping("/courseTeacher")
public class CourseTeacherController {

    @Autowired
    private CourseTeacherService courseTeacherService;

    @ApiOperation("查询教师信息")
    @GetMapping("/list/{courseId}")
    public List<CourseTeacher> listTeachers(@PathVariable Long courseId){
      return   courseTeacherService.listTeachers(courseId);
    }

    @ApiOperation("新增教师")
    @PostMapping
    public CourseTeacher createTeacher(@RequestBody CourseTeacher courseTeacher){
      return   courseTeacherService.createTeacher(courseTeacher);
    }

    @ApiOperation("删除教师")
    @DeleteMapping("/course/{courseId}/{teacherId}")
    public void deleteTeacher(@PathVariable Long courseId,@PathVariable Long teacherId){
        courseTeacherService.deleteTeacher(courseId,teacherId);
    }


 }
